﻿@model Peninsula.Web.Models.RepairOrder.RepairOrderPagedListModel
<div class="portlet">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i>搜索
        </div>
    </div>
    <div class="portlet-body form">
        <!-- BEGIN FORM -->
        <form class="form-horizontal" id="js-search-form">
            <div class="form-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-3" for="Keyword">
                                关键字：
                            </label>
                            <div class="col-md-6">
                                @Html.TextBoxFor(m => m.Keyword, new { @class = "form-control", @placeholder = "订单标题/分类" })
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-3" for="Keyword">
                                状态：
                            </label>
                            <div class="col-md-9">
                                @Html.DropDownListFor(t =>t.hdOrderStatus, SelectListItemsHelper.FromEnum(typeof(HDOrderStatus), extraFirstItem: "请选择"), new { @class = "form-control" })
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-offset-4 col-md-8">
                        <button type="submit" class="btn btn-success">搜索</button>
                        <button type="button" class="btn btn-default js-search-form-reset-button">重置</button>
                    </div>
                </div>
            </div>
        </form>
        <!-- END FORM -->
    </div>
</div>
<!-- END SEARCH FORM PORTLET -->
<!-- BEGIN TABLE PORTLET -->
<div class="portlet box light-grey">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i>维修订单跟踪
        </div>
    </div>
    <div class="portlet-body">
        <div class="dataTables_wrapper form-inline">
            <div class="table-scrollable">
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>
                                操作
                            </th>
                            <th>
                                订单标题
                            </th>
                            <th>
                                分类
                            </th>
                            <th>
                                订单状态
                            </th>
                            <th>
                                预约时间
                            </th>
                            <th>
                                结束时间
                            </th>
                            <th>
                                维修店面                                                                                                                             
                            </th>
                            <th>
                                维修人员
                            </th>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.PagedList)
                        {
                            <tr>
                                <td>
                                    <a href="@Url.Action("Details","RepairOrder",new { id = item.Id })" class="btn btn-info btn-xs"><i class="fa fa-eye"></i>详情</a>
                                    @{
                                        if (item.Status == OrderStatus.Submitted)
                                        {
                                            <a href="@Url.Action("CreateOrEditRepairOrder","RepairOrder",new { id = item.Id })" class="btn btn-info btn-xs"><i class="fa fa-edit"></i>编辑</a>
                                            <a data-confirm-text="确定要删除吗？" data-confirm-button="确定" data-cancel-button="取消"
                                               data-confirmed-url="@Url.Action("DeleteSumbit", "RepairOrder", new { id = item.Id })"
                                               class="btn btn-danger btn-xs js-table-ajax-confirm-button">
                                                <i class="fa fa-trash-o"></i>删除
                                            </a>
                                        }
                                        if (item.Status == OrderStatus.RepairFinished)
                                        {
                                            @*<a href="@Url.Action("CreateOrEditRepairOrder","RepairOrder",new { id = item.Id })" class="btn btn-success btn-xs"><i class="fa fa-money"></i>付款</a>*@
                                            <a data-confirm-text="确定支付？" data-confirm-button="确定" data-cancel-button="取消"
                                               data-confirmed-url="@Url.Action("Payment", "RepairOrder", new { id = item.Id })"
                                               class="btn btn-success btn-xs js-table-ajax-confirm-button">
                                                <i class="fa fa-money"></i>支付
                                            </a>
                                        }
                                    }
                                </td>
                                <td>
                                    @Html.DisplayFor(m => item.Name)
                                </td>
                                <td>
                                    @(item.ItemType?.Name)
                                </td>
                                <td>
                                    @item.Status.EnumDescription()
                                   
                                </td>
                                <td>
                                    @Html.DisplayFor(m => item.Appointment)
                                </td>
                                <td>
                                    @Html.DisplayFor(m => item.EndTime)
                                </td>
                                <td>
                                   @(item.Store?.Name)
                                </td>
                                <td>
                                   @(item.MaintenanceStaff?.TrueName)
                                </td>
                            </tr>
                        }

                    </tbody>
                </table>
            </div>
            @Html.Partial("_Pagination", Model.PagedList, Model.QueryParameter)
        </div>
    </div>
</div>
<!-- BEGIN TABLE PORTLET -->